Hệ thống quản lý trường học bằng PHP / MySQLi

1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset=
"UTF-8">
5 <title>Password Reminder</title>
6     <meta charset=
"utf-8">
7     <meta name=
"viewport" content="width=device-width, initial-scale=1.0">
8     <title>school management system</title>
9     <link rel=
"shortcut icon" href="assets/img/title.gif" type="image/x-icon">
10     <link rel=
"stylesheet" href="assets/css/bootstrap.min.css">
11     <link href=
"assets/css/loader.css" rel="stylesheet" />
12     <script src=
"assets/js/canvasjs.min.js"></script>
13     <!--*****jquery -
3.2.1.js file supports the use of dropdown***-->
14     <script src=
"assets/js/jquery-3.2.1.js"></script>
15
16 </head>
17 <body>
18
19  <div
class="col-md-12" style="background-color:#526F35; position:relative;top:0px;">
20         <p
class="text-center text-danger" style="color:white;" > Enter your email in the form below to have your password sent to you.</p>
21  </div>
22
23 <?php
24     
if (!array_key_exists('Submitted',$_POST))
25     {
26 ?>
27         <div
class="row">
28         <div
class="col-sm-3">
29         </div>
30         <div
class="col-sm-6" >
31
32         <br>
33         <br>
34         <br>
35                                
36         <div >
37         <form method=
"post" action="email.php">
38         <input type=
"hidden" name="Submitted" value="true"><br>
39         <label>The system will send emails to all the persons(Parent/students) whose emails adress has entered corrently. </label>
40         <label><input type=
"checkbox" name="checkbox" value="value">Parents</label>
41         <label><input type=
"checkbox" name="checkbox" value="value">Students</label>
42         <input type=
"text" name="To" size="25" class="form-control"><br>
43         <textarea rows=
"10" name="bulkemails" class="form-control">
44         Dear Parent,
45         ------------------------------------------
46
47         </textarea><br>
48         <input type=
"submit" value="Send Email"> <a href="homepage.php">Back to homepage</a>
49         </form>
50         </div>
51 <?php
52     }
53     
else
54     {
55         $to = $_POST[
'To'];
56         $bulkemails = $_POST[
'bulkemails'];
57         @$db =
new mysqli('localhost','root','','sms2');
58         
if (mysqli_connect_errno())
59         {
60           echo
'Cannot connect to database: ' . mysqli_connect_error();
61         }
62         
else
63         {
64             $query =
"SELECT email FROM studentstable ";
65             $result = $db->query($query);
66             $row=$result->fetch_assoc();
67             $email = $row[
'email'];
68             $fname = $row[
'fname'];
69             
//Sending of password using phpmmailer
70             require(
"PHPMailer_5.2.0/class.phpmailer.php");
71             
72             $message =
"$bulkemails";
73         
74             $mail =
new PHPMailer(); //Use phpmailer to send instead of inbult php mail()
75             $mail->isSMTP();
// Set mailer to use SMTP
76             $mail->Host =
'smtp.gmail.com'; // Specify main and backup SMTP servers
77             $mail->SMTPAuth =
true; // Enable SMTP authentication
78             $mail->Username =
'emaxsystemmailer@gmail.com';// SMTP username
79             $mail->Password =
'john100john'; // SMTP password
80             $mail->SMTPSecure =
'ssl'; // Enable TLS encryption, `ssl` also accepted
81             $mail->FromName =
"Mailer";
82             $mail->WordWrap =
50; // set word wrap
83             $mail->IsHTML(
true); // send as HTML
84             $mail->Port =
465; // TCP port to connect to
85
86             $mail->From =
'emaxsystemmailer@gmail.com';
87             $mail->FromName =
'System Admin';
88             $mail->AddAddress($to);
//change it to your email address to actually get the email!
89             $mail->AddBCC(
'jmuthama78@yahoo.com');
90             $mail->AddReplyTo(
'emaxsystemmailer@gmail.com');
91         
92             $mail->Subject =
'password Reminder';
93             $mail->Body = $message;
94         
95             
if($mail->Send())
96             {
97                 echo
"Your password has been sent.";
98                 echo
'<br>';
99                 echo
'<a button class="btn btn-success" title="Click to bo back"
100                                                  href=
"index.php">Back</a>';
101             }
102             
else
103             {
104                  echo
"We could not send your password.<br>";
105                  echo
"Mailer Error: " . $mail->ErrorInfo;
106                  echo
'<br>';
107                  echo
'<a button class="btn btn-success" title="Click to bo back"
108                                                      href=
"index.php">Back</a>';
109              }
110         }
111     }
112 ?>
113
114 </div>
115
116 <div
class="col-md-12" style="background-color:#526F35; position:fixed;bottom:0px;">
117         <p
class="text-center text-danger" style="color:white;" >@J. Muthama Tel: +254729734768</p>
118     </div>
119 </body>
120 </html>


Gõ tìm kiếm nhanh...